unit UTestPerTanim;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Mask, wwdbedit, Wwdotdot, Wwdbcomb, DB, ADODB, StdCtrls,
  wwdblook, Grids, Wwdbigrd, Wwdbgrid, Buttons, ExtCtrls, Menus;

type
  TFrmTestPerTanimla = class(TForm)
    Panel3: TPanel;
    Label5: TLabel;
    Label6: TLabel;
    BitBtn3: TBitBtn;
    wwDBGrid6: TwwDBGrid;
    personelk: TwwDBLookupCombo;
    p_tekniktipi_calisanQ: TADOQuery;
    p_tekniktipi_calisanQS: TDataSource;
    durumustk: TwwDBComboBox;
    PerEkle: TwwDBLookupCombo;
    Button1: TButton;
    ADOTemp: TADOQuery;
    PopupMenu1: TPopupMenu;
    Sil1: TMenuItem;
    procedure durumustkCloseUp(Sender: TwwDBComboBox; Select: Boolean);
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Sil1Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure Doldur;
  end;

var
  FrmTestPerTanimla: TFrmTestPerTanimla;

implementation
 uses Data;
{$R *.dfm}

procedure TFrmTestPerTanimla.Doldur;
begin
       p_tekniktipi_calisanQ.Close;
       p_tekniktipi_calisanQ.SQL.Text:='select TP.perkod as perkod ,P.Adi + '' '' + P.Soyadi as AdSoyad '+
       ' from Test_Personel TP Join Perkart P on TP.perkod=P.perkod where ' +
       ' TP.Yer=:YER';
       p_tekniktipi_calisanQ.Parameters.ParamByName('YER').Value:= durumustk.Value;
       p_tekniktipi_calisanQ.Open;
end;
procedure TFrmTestPerTanimla.durumustkCloseUp(Sender: TwwDBComboBox;
  Select: Boolean);
begin
     Doldur;
end;

procedure TFrmTestPerTanimla.FormShow(Sender: TObject);
begin
  Doldur ;
end;

procedure TFrmTestPerTanimla.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin


  action := cafree;
  FrmTestPerTanimla := Nil;
end;

procedure TFrmTestPerTanimla.BitBtn3Click(Sender: TObject);
begin
  Close;
end;

procedure TFrmTestPerTanimla.Button1Click(Sender: TObject);
var Perkod:integer;
begin
if trim(PerEkle.Text)=''  then exit;

perkod:=strtoint(PerEkle.LookupValue);

ADOTemp.close;
adotemp.SQL.Text:='insert into Test_Personel (Perkod,Yer) Values ('+
inttostr(Perkod)+ ','+#39+ durumustk.Value + #39 + ')';
Adotemp.ExecSQL ;

doldur;
end;

procedure TFrmTestPerTanimla.Sil1Click(Sender: TObject);
begin
  p_tekniktipi_calisanQ.Delete;
end;



end.
